package com.example.day6;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class Main2Activity extends AppCompatActivity {
    Button button;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.e("#####main2","onCreate");
        setContentView(R.layout.activity_main2);
        Intent intent = getIntent();
        String aa = intent.getStringExtra("name");
        button=findViewById(R.id.button2);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                Intent intent = new Intent(Main2Activity.this,MainActivity.class);
//                intent.putExtra("name","aaaaa");
//                Main2Activity.this.startActivity(intent);
                finish();
            }
        });
        button.setText(aa);
    }
    @Override
    public void onStop() {
        super.onStop();
        Log.e("#####main2","onStop");
    }
    @Override
    public void onRestart() {
        super.onRestart();
        Log.e("#####main2","onRestart");
    }

    @Override
    public void onResume() {

        super.onResume();
        Log.e("#####main2","onResume");
    }
    @Override
    public void onDestroy() {
        super.onDestroy();

        Log.e("#####main2", "onDestroy");
    }

    @Override
    public void onPause() {
        super.onPause();
        Log.e("#####main2", "onPause");
    }

    @Override
    public void onStart() {

        super.onStart();
        Log.e("#####main2", "onStart");
    }


}
